
//use "C:\Users\mjoshi2\Box\2021 Research\2022 Research\Nepal court conflict research\Paper2\2022-09-12 Nepal Court Paper2_data.dta", replace

use  "C:\Users\mjoshi2\Box\2023 Research\NEPAL RESEARCH\Nepal court conflict research\Paper2\Paper2RepData\Nepal Paper 2.dta" 



log using "C:\Users\mjoshi2\Box\2023 Research\NEPAL RESEARCH\Nepal court conflict research\Paper2\Political Geography\RR1\2023-08-23Logfile.smcl", replace
set seed 123456
sort sno year


 
 
 keep sno district year total_court_cases total_court_cases total_civil_cases lag_civil_cases  total_criminal_cases lag_criminal_cases lag_total_cases ln_cum_state_victims  ln_cum_maoist_victims peoples_govt_active	/*
 */ln_newNGOs ln_pop percent_votes1991_1999_GAP litrate_1991_2001_GAP road_density_GAP 	/*
 */ln_abs_total2001 hilli_region mountain_region region_east region_mid region_west region_farwest year2002 
 
 
//correlations
 corr total_court_cases L.total_court_cases total_civil_cases lag_civil_cases  total_criminal_cases lag_criminal_cases ln_cum_state_victims  ln_cum_maoist_victims peoples_govt_active	/*
 */ln_newNGOs ln_pop percent_votes1991_1999_GAP litrate_1991_2001_GAP road_density_GAP 	/*
 */ln_abs_total2001 hilli_region mountain_region region_east region_mid region_west region_farwest year2002 if year>1995 & year<2007
 
 //descriptive statistics
 sum total_court_cases L.total_court_cases total_civil_cases lag_civil_cases  total_criminal_cases lag_criminal_cases ln_cum_state_victims  ln_cum_maoist_victims peoples_govt_active	/*
 */ln_newNGOs ln_pop percent_votes1991_1999_GAP litrate_1991_2001_GAP road_density_GAP 	/*
 */ln_abs_total2001 hilli_region mountain_region region_east region_mid region_west region_farwest year2002 if year>1995 & year<2007
 


//Preliminary Working Models
//exclude ln_abs_total2001
//Civil cases
xtnbreg total_civil_cases lag_civil_cases  ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002  hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

collin total_civil_cases lag_civil_cases  ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002  hilli_region mountain_region region_east region_mid region_west region_farwest sno if year>1995 & year<2007 

test
test  ln_cum_state_victims peoples_govt_active
estat ic
//////////////////////
//prediction after the model CIVIL CASES
xtnbreg total_civil_cases lag_civil_cases  ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002  hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

margins, atmeans at(ln_cum_state_victims =(0(.5)6.5))
marginsplot, addplot(hist ln_cum_state_victims)

//Margins for people's government
margins, atmeans at(peoples_govt_active=0)
margins, atmeans at(peoples_govt_active=1)

//////////////////

xtnbreg total_civil_cases lag_civil_cases  ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

collin total_civil_cases lag_civil_cases  ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest sno if year>1995 & year<2007 

test
test ln_cum_maoist_victims peoples_govt_active
estat ic

//////////////////////
//prediction after the model CIVIL CASES
xtnbreg total_civil_cases lag_civil_cases  ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

margins, atmeans at(ln_cum_maoist_victims =(0(.5)5.5))
marginsplot, addplot(hist ln_cum_maoist_victims)

////////////////////////////////////CRIMINAL CASES


//Criminal cases
xtnbreg total_criminal_cases lag_criminal_cases ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

collin total_criminal_cases lag_criminal_cases ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest sno if year>1995 & year<2007 

test
test ln_cum_state_victims peoples_govt_active
estat ic

/////////////Prediction following Criminal cases STATE
xtnbreg total_criminal_cases lag_criminal_cases ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 
 margins, atmeans at(ln_cum_state_victims =(0(.5)6.5))
marginsplot, addplot(hist ln_cum_state_victims)

//Margins for people's government
margins, atmeans at(peoples_govt_active=0)
margins, atmeans at(peoples_govt_active=1)
 
 ///////////////////

xtnbreg total_criminal_cases lag_criminal_cases ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

collin total_criminal_cases lag_criminal_cases ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest sno if year>1995 & year<2007 

test
test ln_cum_maoist_victims peoples_govt_active
estat ic

/////////////Prediction following Criminal cases MAOIST
xtnbreg total_criminal_cases lag_criminal_cases ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 
margins, atmeans at(ln_cum_maoist_victims =(0(.5)5.5))
marginsplot, addplot(hist ln_cum_maoist_victims)
 ///////////////////
 
 
//Total Cases

xtnbreg total_court_cases lag_total_cases ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

collin total_court_cases lag_total_cases ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest sno if year>1995 & year<2007 

test
test ln_cum_state_victims peoples_govt_active
estat ic

xtnbreg total_court_cases lag_total_cases ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

collin total_court_cases lag_total_cases ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest sno if year>1995 & year<2007 


test
test ln_cum_maoist_victims peoples_govt_active
estat ic



//Model specification testss
//Civil cases
quietly xtpoisson total_civil_cases lag_civil_cases  ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest if year>1995 & year<2007, fe 

est store po_st_civil

quietly xtnbreg total_civil_cases lag_civil_cases  ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

est store nb_st_civil 

quietly xtpoisson total_civil_cases lag_civil_cases  ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest if year>1995 & year<2007, fe  

est store po_mao_civil

quietly xtnbreg total_civil_cases lag_civil_cases  ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

est store nb_mao_civil

//Criminal cases 
quietly xtpoisson total_criminal_cases lag_criminal_cases ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest if year>1995 & year<2007, fe  

est store po_st_cri

quietly xtnbreg total_criminal_cases lag_criminal_cases ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

est store nb_st_cri

quietly xtpoisson total_criminal_cases lag_criminal_cases ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest if year>1995 & year<2007, fe  

est store po_mao_cri

quietly xtnbreg total_criminal_cases lag_criminal_cases ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

est store nb_mao_cri
 
 
//Total Cases

quietly xtpoisson total_court_cases lag_total_cases ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest if year>1995 & year<2007, fe 
est store po_st_total
 

quietly xtnbreg total_court_cases lag_total_cases ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

est store nb_st_total

quietly xtpoisson total_court_cases lag_total_cases ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest if year>1995 & year<2007, fe 
est store po_mao_total

quietly xtnbreg total_court_cases lag_total_cases ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

est store nb_mao_total

//Model 1
lrtest po_st_civil nb_st_civil, stats force 

//Model 2

lrtest po_mao_civil nb_mao_civil, stats force

//Model 3
lrtest  po_st_cri nb_st_cri, stats force

//Model 4
lrtest  po_mao_cri nb_mao_cri, stats force

//Model 5
lrtest  po_st_total nb_st_total, stats force
//Model 6

lrtest  po_mao_total nb_mao_total, stats force



///Poission Fixed Effects Appendix Table 4a
//Appendix Table with Poission specification 

//Civil cases
xtpoisson total_civil_cases lag_civil_cases  ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest if year>1995 & year<2007, fe 

xtpoisson total_civil_cases lag_civil_cases  ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest if year>1995 & year<2007, fe  

//Criminal cases 
xtpoisson total_criminal_cases lag_criminal_cases ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest if year>1995 & year<2007, fe  

xtpoisson total_criminal_cases lag_criminal_cases ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest if year>1995 & year<2007, fe  

//Total Cases

xtpoisson total_court_cases lag_total_cases ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest if year>1995 & year<2007, fe 

xtpoisson total_court_cases lag_total_cases ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest if year>1995 & year<2007, fe 

//Appendix Table 4b. include absent population, exclude pop (log)
//Civil cases
xtnbreg total_civil_cases lag_civil_cases  ln_cum_state_victims peoples_govt_active ln_abs_total2001 percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002  hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

xtnbreg total_civil_cases lag_civil_cases  ln_cum_maoist_victims peoples_govt_active ln_abs_total2001 percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 


//Criminal cases 
xtnbreg total_criminal_cases lag_criminal_cases ln_cum_state_victims peoples_govt_active ln_abs_total2001 percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

xtnbreg total_criminal_cases lag_criminal_cases ln_cum_maoist_victims peoples_govt_active ln_abs_total2001 percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

 
//Total Cases

xtnbreg total_court_cases lag_total_cases ln_cum_state_victims peoples_govt_active ln_abs_total2001 percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

xtnbreg total_court_cases lag_total_cases ln_cum_maoist_victims peoples_govt_active ln_abs_total2001 percent_votes1991_1999_GAP	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 



//Appendix Table 4c. NGOs/CSOs (log)
//Civil cases
xtnbreg total_civil_cases lag_civil_cases  ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	ln_newNGOs	///
litrate_1991_2001_GAP road_density_GAP year2002  hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

xtnbreg total_civil_cases lag_civil_cases  ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	ln_newNGOs	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 


//Criminal cases 
xtnbreg total_criminal_cases lag_criminal_cases ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP ln_newNGOs	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

xtnbreg total_criminal_cases lag_criminal_cases ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	ln_newNGOs	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

 
//Total Cases
xtnbreg total_court_cases lag_total_cases ln_cum_state_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	ln_newNGOs	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

xtnbreg total_court_cases lag_total_cases ln_cum_maoist_victims peoples_govt_active ln_pop percent_votes1991_1999_GAP	ln_newNGOs	///
litrate_1991_2001_GAP road_density_GAP year2002 hilli_region mountain_region region_east region_mid region_west region_farwest i.sno if year>1995 & year<2007 

  
log close

